<?php

namespace apiend\modules\school\controllers;

use Yii;
use apiend\components\Controller;
use apiend\modules\school\models\TeacherSearch;
use apiend\modules\school\models\TeacherForm;
use common\models\teacher\Teacher;

/**
 * 学校相关接口
 * Default controller for the `educater` module
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class DefaultController extends Controller {

    public $modelClass = 'apiend\modules\school\models\SchoolSearch';

    /**
     * {@inheritdoc}
     */
    public function actions() {
        return [
            'view' => [
                'class' => 'yii\rest\ViewAction',
                'modelClass' => $this->modelClass,
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    public function actionIndex() {
        /* @var $modelClass \apiend\modules\school\models\SchoolSearch */
        $modelClass = new $this->modelClass;
        return $modelClass->search(Yii::$app->request->queryParams);
    }

}
